package br.siseventos.model;
// Generated 18/08/2012 11:34:56 by Hibernate Tools 3.2.1.GA

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * TbLocal generated by hbm2java
 */
@Entity
@Table(name = "tb_local", catalog = "SisEventosDB", uniqueConstraints =
@UniqueConstraint(columnNames = "nme_local"))
public class TbLocal implements java.io.Serializable {

    private Integer idtLocal;
    private TdTipoLocal tdTipoLocal;
    private String nmeLocal;
    private int qtdVagasLocal;
    private Set<TaAlocacaoLocal> taAlocacaoLocals = new HashSet<TaAlocacaoLocal>(0);
    private Set<TaPermissaoLocal> taPermissaoLocals = new HashSet<TaPermissaoLocal>(0);

    public TbLocal() {
    }

    public TbLocal(TdTipoLocal tdTipoLocal, String nmeLocal, int qtdVagasLocal) {
        this.tdTipoLocal = tdTipoLocal;
        this.nmeLocal = nmeLocal;
        this.qtdVagasLocal = qtdVagasLocal;
    }

    public TbLocal(TdTipoLocal tdTipoLocal, String nmeLocal, int qtdVagasLocal, Set<TaAlocacaoLocal> taAlocacaoLocals, Set<TaPermissaoLocal> taPermissaoLocals) {
        this.tdTipoLocal = tdTipoLocal;
        this.nmeLocal = nmeLocal;
        this.qtdVagasLocal = qtdVagasLocal;
        this.taAlocacaoLocals = taAlocacaoLocals;
        this.taPermissaoLocals = taPermissaoLocals;
    }

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "idt_local", unique = true, nullable = false)
    public Integer getIdtLocal() {
        return this.idtLocal;
    }

    public void setIdtLocal(Integer idtLocal) {
        this.idtLocal = idtLocal;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "cod_tipo_local", nullable = false)
    public TdTipoLocal getTdTipoLocal() {
        return this.tdTipoLocal;
    }

    public void setTdTipoLocal(TdTipoLocal tdTipoLocal) {
        this.tdTipoLocal = tdTipoLocal;
    }

    @Column(name = "nme_local", unique = true, nullable = false, length = 80)
    public String getNmeLocal() {
        return this.nmeLocal;
    }

    public void setNmeLocal(String nmeLocal) {
        this.nmeLocal = nmeLocal;
    }

    @Column(name = "qtd_vagas_local", nullable = false)
    public int getQtdVagasLocal() {
        return this.qtdVagasLocal;
    }

    public void setQtdVagasLocal(int qtdVagasLocal) {
        this.qtdVagasLocal = qtdVagasLocal;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tbLocal")
    public Set<TaAlocacaoLocal> getTaAlocacaoLocals() {
        return this.taAlocacaoLocals;
    }

    public void setTaAlocacaoLocals(Set<TaAlocacaoLocal> taAlocacaoLocals) {
        this.taAlocacaoLocals = taAlocacaoLocals;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tbLocal")
    public Set<TaPermissaoLocal> getTaPermissaoLocals() {
        return this.taPermissaoLocals;
    }

    public void setTaPermissaoLocals(Set<TaPermissaoLocal> taPermissaoLocals) {
        this.taPermissaoLocals = taPermissaoLocals;
    }
}
